<?php
// 本类由系统自动生成，仅供测试用途
class PublicAction extends Action {
    public function login(){

    	if (IS_POST) {
    		$username = $this->_post('name');
    		$password =  $this->_post('pwd','md5');

    		$this->validUser($username,$password);
    	}else{
    		$this->display(); 
    	}
    	
    }

    public function loginout(){
		echo "loginout";
    }

    public function verify(){
		echo "loginout";
    }

    private function validUser($username,$password)
    {
    	if($username == 'admin' && $password == md5('admin')) {
    		session('user','admin');
    		$this->redirect('Admin/Index/index');
    	}else{
    		C('LAYOUT_ON',false);
    		$this->error('用户名密码错误！');
    	}
    }
}